import { createBrowserRouter } from "react-router-dom";
import App from "../App";
import { lazy } from "react";
import Icon, {
    DesktopOutlined,
    FileOutlined,
    PieChartOutlined,
    TeamOutlined,
    UserOutlined,
  } from '@ant-design/icons';
const Backendhone = lazy(() => import('../pages/backendhome/Index'))
const Hone = lazy(() => import('../pages/home/Index'))
const Login = lazy(() => import('../pages/login/Index'))
const Todo = lazy(() => import('../pages/todo/Index'))
const My = lazy(() => import('../pages/my/Index'))
const Data = lazy(() => import('../pages/data/Index'))
const Xq = lazy(() => import('../pages/xq/Index'))
const Sy = lazy(() => import('../pages/sy/Index'))
const List = lazy(() => import('../pages/list/Index'))
const Tab = lazy(() => import('../pages/tab/Index'))
const Time = lazy(() => import('../pages/time/Index'))
const Texts = lazy(() => import('../pages/texts/Index'))
const Tab1 = lazy(() => import('../pages/texts/tab1/Index'))
const Tab2 = lazy(() => import('../pages/texts/tab2/Index'))

export const homeRouter = [
    {
        path: '/home/list',
        element: <List />,
        title: '列表'
    },
    {
        path: '/home/todo',
        element: <Todo />,
        title: '分类'
    },
    {
        path: '/home/data',
        element: <Data />,
        title: '归档'
    },
    {
        path: '/home/my',
        element: <My />,
        title: '我的'
    },

]
export const backends = [
    {
        path: '/backendhome/tab',
        element: <Tab />,
        title: '首页',
        icon: <PieChartOutlined />
    },
    {
        path: '/backendhome/time',
        element: <Time />,
        title: '用户管理',
        icon: <DesktopOutlined />
    },
    {
        path: '/backendhome/texts',
        element: <Texts />,
        title: '列表管理',
        icon: <FileOutlined />,
        children: [
            {
                path: '/backendhome/texts/tab1',
                element: <Tab1 />,
                title: '功能列表',
                icon: <PieChartOutlined />
            },
            {
                path: '/backendhome/texts/tab2',
                element: <Tab2 />,
                title: '列表展示',
                icon: <PieChartOutlined />
            }
        ]
    }

]
const routes = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        children: [
            { index: true, element: <Hone /> },
            {
                path: '/home',
                element: <Hone />,
                children: homeRouter
            }
        ]
    }, {
        path: '/login',
        element: <Login />
    },
    {
        path: '/',
        element: <Sy />,
        children: [
            {index:true,element:<Backendhone/>},
            {
                path: '/backendhome',
                element: <Backendhone />,
                children: backends
            }
        ]
    },
    {
        path: '/xq/:id',
        element: <Xq />
    },
])
export default routes;